﻿using Sustainalytics.Entities.ESGRatings;
using Sustainalytics.SharedEntities.EsgResearch;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Sustainalytics.ClientDW.Synchronization.SyncESGData.ESGAssessmentThresholdLogic
{
    public class EsgAssessmentThresholdMapper
    {
        public EsgFocusThresholds Map(EsgAssessmentThreshold entity)
        {
            return new EsgFocusThresholds
            {
                Id = entity.Id,
                PeerGroup = entity.PeerGroup,
                Value = entity.Value,
                LowerBound = entity.LowerBound,
                UpperBound = entity.UpperBound,
                Type = (Sustainalytics.Entities.ESGRatings.ThresholdType)entity.Type,// temporary workaround till we get the type from the source when Type = entity.Type
                ThresholdGroupId = Guid.NewGuid(),
                UploadTime = DateTime.UtcNow
            };
        }

        public IList<EsgFocusThresholds> MapManyToMany(IList<EsgAssessmentThreshold> entities)
        {
            //return entities.SelectMany(MapOneToMany).ToList();// temporary workaround till we get all the thresholds from the source
            return entities.Select(Map).ToList(); //original & final implementation
        }

       
    }
}
